from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical, images, users, specs
# rest_framwork 这个可以自动生成路由
from rest_framework.routers import DefaultRouter


urlpatterns = [
    # 用户登录,这个jwt的视图使用的序列化器没有传入response的值，而自定义的使用的是response=None
    url(r'^authorizations/$',  obtain_jwt_token),
    # ==========================统计视图页面================================
    # 统计用户-总数
    url(r'^statistical/total_count/$', statistical.UserTotalCountView.as_view()),
    # 统计日增用户总数
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    # 统计日活跃用户
    url(r'^statistical/day_active/$', statistical.UserActiveCountView.as_view()),
    # 统计日下单用户的数量
    url(r'^statistical/day_orders/$', statistical.UserOrderCountView.as_view()),
    # 月增用户统计
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    # 日分类商品访问量
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()),
    # ===============================用户信息==========================================
    # 用户信息查询
    url(r'^users/$', users.UserView.as_view()),
    # ===============================简单查询规格数据=====================================
    url(r'goods/simple/$', specs.SpecsView.as_view({'get':'simple'})),
    # ===============================简单查询SKU数据=====================================
    url(r'skus/simple/$', images.ImageView.as_view({'get': 'simple'})),
]

# ------------------------规格路由表----------------------------
router = DefaultRouter()
router.register('goods/specs', specs.SpecsView, basename='specs')
urlpatterns += router.urls

# ------------------------图片路由表----------------------------
router = DefaultRouter()
router.register('skus/images', images.ImageView, basename='image')
urlpatterns += router.urls